package org.example.mytest.newControler;

import org.example.mytest.newMapper.CompaniesMapper;
import org.example.mytest.newMapper.EmployeesMapper;

import org.example.mytest.newMapper.InventorylogsMapper;
import org.example.mytest.newentity.companies;
import org.example.mytest.newentity.employees;

import org.example.mytest.newentity.inventorylogs;
import org.example.mytest.newentity.users;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@MapperScan("org.example.mytest.newMapper")
@RequestMapping("/inventorylogs")
public class InventorylogsControler
{
    @Autowired
    private InventorylogsMapper  inventorylogsMapper;
    @GetMapping("/query0")
    public List query2() {
        List<inventorylogs> list = inventorylogsMapper.selectList(null);
        return list;
    }

    @PostMapping("/save")
    public int save(@RequestBody inventorylogs users){

        int result = inventorylogsMapper.insert(users);
        return result;
    }
    @DeleteMapping("/delete1/{userId}")
    public int delete1(@PathVariable("userId") Integer userId){
        int row=inventorylogsMapper.deleteById(userId);
        return row;
    }


}